package cn.fz.event.describe;

import cn.fz.entity.User;
import cn.fz.event.publish.LoginApplicationEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

/**
 * ⑦通过@EventListener方式订阅消息，实现签到业务处理
 */
@Service
public class SignNotifyListen {
    public void signNotify(User user) {
        System.out.println("=======签到业务======" + user);
    }

    @EventListener
    public void onLoginEvent(LoginApplicationEvent loginApplicationEvent) {
        System.out.println("===============收到登录通知事件===================");
        User user = (User) loginApplicationEvent.getSource();
        signNotify(user);
    }
}
